#include "NewNode.h"
#include "TypeNode.h"
#include "Output/Console.h"

CNewNode::CNewNode(std::weak_ptr<CScriptFileContext> InFile)
    : CExpressionNode(InFile, EASTNodeType::New)
{
}

void CNewNode::DebugPrint(int32_t InDepth)
{
    // Print Depth
    for (int32_t i = 0; i < InDepth; i++)
    {
        WH::Print(U"\t");
    }

    WH::Print(U"new ");

    Type->DebugPrint(0);

    WH::Print(U"(");

    for (int32_t i = 0; i < Arguments.size(); i++)
    {
        Arguments[i]->DebugPrint(0);
        if (i != Arguments.size() - 1)
        {
            WH::Print(U",");
        }
    }

    WH::Print(U")");
}

std::shared_ptr<CScriptToken> CNewNode::GetFirstToken()
{
    return New;
}
